package com.znjc.device.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.znjc.common.annotation.Excel;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 【请填写功能名称】对象 device_type
 *
 * @author zengpc
 * @date 2023-12-04
 */
@Data
@TableName(value = "device_type")
public class DeviceType extends BaseZnjcEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 设备类别名称
     */
    @Excel(name = "设备类别名称")
    private String name;

    /**
     * 设备类别编码
     */
    @Excel(name = "设备类别编码")
    private String code;

    /**
     * 设备类别图片地址
     */
    @Excel(name = "设备类别图片地址")
    private String imageUrl;

    /**
     * 采集类别 0实时采集 1定时采集
     */
    @Excel(name = "采集类别 0实时采集 1定时采集")
    private String gatherType;

    /**
     * 采集时间 cron表达式
     */
    @Excel(name = "采集时间 cron表达式")
    private String gatherTime;

    /**
     * 采集状态 数据字典：gather_status 0开启 1关闭
     */
    @Excel(name = "采集状态")
    private String gatherStatus;

    /**
     * 是否存在此串口标识 默认不存在
     */
    @TableField(exist = false)
    private boolean flag = false;

    public boolean isAdmin() {
        return isAdmin(this.getId());
    }

    public static boolean isAdmin(Long id) {
        return id != null && 1L == id;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("code", getCode())
                .append("imageUrl", getImageUrl())
                .append("gatherType", getGatherType())
                .append("gatherTime", getGatherTime())
                .append("status", getStatus())
                .append("delFlag", getDelFlag())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("deptId", getDeptId())
                .append("remark", getRemark())
                .toString();
    }
}
